package com.shengzai.zookeeper;

import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;

public class ZookeeperConCode {
    public static void main(String[] args) throws IOException, InterruptedException {
        Watcher watcher = new Watcher(){
            @Override
                public void process(WatchedEvent event){
                System.out.println("process正在执行");
            }
        };
        ZooKeeper zooKeeper = new ZooKeeper("master:2181,node1:2181,node2:2181", 1000000,watcher);
        System.out.println("连接成功");

        zooKeeper.close();
    }
}
